package cn.iocoder.yudao.module.handguard.tool;

import com.alibaba.fastjson.JSON;
import com.lw.reptiles.dto.JsonResult;
import com.lw.reptiles.service.ReptilesService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.Random;
import java.util.regex.Pattern;

/**
 * @author: liuweijun
 * @since: 2023/9/11 16:32
 * @description:
 */
@Slf4j
public class TestMain {

    public static void main(String[] args) {
//        for (int i=1;i<9;i++){
//            System.out.println(i);
//        }
//        long seed = System.currentTimeMillis();
//        Random rng = new Random(seed);
//        long number = (rng.nextLong() % 900000000) + 100000000;
//        System.out.println(number);

        //BigDecimal a = new BigDecimal("10.000");
        //BigDecimal b = new BigDecimal("10.00");
        //boolean areEnough = areEnoughToSubtract(a, b);
        //System.out.println("Are enough to subtract: " + areEnough);

        //
        //System.out.println("额度："+CalculateUtils.formatMoneyUnit(new BigDecimal(0)));

        //JsonResult result1 = ReptilesService.getHousingData(1,10,"重庆市");
        //log.info("获取到爬取的数据："+ JSON.toJSONString(result1));
        //
        //JsonResult result2 = ReptilesService.getHousingShangYeData(1,10,"重庆市");
        //log.info("获取到爬取的数据："+ JSON.toJSONString(result2));

//        String numStr = StringUtils.getDigits("连续/3");
//        System.out.println(numStr);

//        Double a1 = Double.valueOf(StringUtils.getDigits("1"));
//        Double a2 = Double.valueOf(StringUtils.getDigits("10"));
//        Double b = Double.valueOf(StringUtils.getDigits("9"));
//        if (a1<=b && a2>=b) {
//            System.out.printf("true");
//        }else {
//            System.out.printf("false");
//        }

        BigDecimal num1 = new BigDecimal("-1");
        BigDecimal num2 = new BigDecimal("1");
        if (num2.compareTo(num1) < 0) {
            System.out.println(num2 + " 小于 " + num1);
        } else if (num2.compareTo(num1) > 0) {
            System.out.println(num2 + " 大于 " + num1);
        } else {
            System.out.println(num2 + " 等于 " + num1);
        }

    }


    
    public static boolean areEnoughToSubtract(BigDecimal a, BigDecimal b) {
        BigDecimal sum = a.subtract(b);
        if (sum.compareTo(BigDecimal.ZERO)< 0){
            return false;
        }else {
            return true;
        }
    }

}
